#!/bin/bash

echo "=== 清除 things_iot_platform 部署脚本 ==="

pkill main_backend
pkill npm
pkill node

# 可选：启动开发服务器
read -p "是否启动开发服务器进行测试？(y/n): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
	echo "=== 启动 things_iot_platform 部署脚本 ==="
	cd things_iot_frontend/
	npm run dev &
	cd ..

	cd things_iot_backend/
	make docker-up
	@echo "等待服务启动..."
	sleep 3	
	make run
	@echo "运行应用程序..."	
	cd ..
fi